home *** CD-ROM | disk | FTP | other *** search
- /**********************************************************************\
-
- File: demo graphics.c
-
- Purpose: This module handles updating the main window (via the
- offscreen bitmaps).
-
-
- MSG Demo -- graphic effects demonstration program
- Copyright (C) 1992-4 Mark Pilgrim & Dave Blumenthal
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program in a file named "GNU General Public License".
- If not, write to the Free Software Foundation, 675 Mass Ave,
- Cambridge, MA 02139, USA.
-
- \**********************************************************************/
-
- #include "demo graphics.h"
- #include "program globals.h"
- #include "msg graphics.h"
-
- PicHandle gPic1ColorPict;
- PicHandle gPic1BWPict;
- PicHandle gPic2ColorPict;
- PicHandle gPic2BWPict;
-
- void InitProgramGraphics(void)
- {
- gPic1ColorPict=gPic1BWPict=gPic2ColorPict=gPic2BWPict=0L;
- }
-
- void DrawTheWindowColor(int index)
- {
- RGBColor oldForeColor, oldBackColor;
- GrafPtr curPort;
-
- GetForeColor(&oldForeColor);
- GetBackColor(&oldBackColor);
-
- GetPort(&curPort);
-
- switch (index)
- {
- case kMainWindow:
- if (!gWhichWipe)
- gWhichPict=!gWhichPict;
- if (gWhichPict)
- DrawThePicture(&gPic1ColorPict, kPic1ColorID, 0, 0);
- else
- DrawThePicture(&gPic2ColorPict, kPic2ColorID, 0, 0);
-
- if (!gWhichWipe)
- gWhichPict=!gWhichPict;
- break;
- default:
- EraseRect(&(curPort->portRect));
- break;
- }
-
- RGBForeColor(&oldForeColor);
- RGBBackColor(&oldBackColor);
- }
-
- void DrawTheWindowBW(int index)
- {
- GrafPtr curPort;
-
- GetPort(&curPort);
-
- switch (index)
- {
- case kMainWindow:
- if (!gWhichWipe)
- gWhichPict=!gWhichPict;
- if (gWhichPict)
- DrawThePicture(&gPic1BWPict, kPic1BWID, 0, 0);
- else
- DrawThePicture(&gPic2BWPict, kPic2BWID, 0, 0);
-
- if (!gWhichWipe)
- gWhichPict=!gWhichPict;
- break;
- default:
- EraseRect(&(curPort->portRect));
- break;
- }
- }
-
- void ShutDownProgramGraphics(void)
- {
- ReleaseThePict(gPic1ColorPict);
- ReleaseThePict(gPic1BWPict);
- ReleaseThePict(gPic2ColorPict);
- ReleaseThePict(gPic2BWPict);
- }
-